package de.oszimt.matse.messenger;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

import de.oszimt.matse.messenger.messages.Message;

public class User 
{
	public static final String USERNAME = "USERNAME";
	public static final String PASSWORD = "PASSWORD";
	public static final String ENABLED = "ENABLED";
	public static final String NAME = "FIRSTNAME";
	public static final String NACHNAME = "LASTNAME";
	public static final String STADT = "CITY";
	public static final String LAND = "COUNTRY";
	public static final String HOBBIES = "HOBBIES";
	public static final String STYLE = "STYLE";
	
	public static final String SENDER = "SENDER_USER_ID";
	public static final String RECIPIENT = "RECIPIENT_USER_ID";
	public static final String MESSAGE = "MESSAGE";
	public static final String TIME = "TIME";
	
	private String name;
	private long lastModification;
	private HashMap<String, User> registeredUser;
	private LinkedList<Message> messageQueue;
	private String style;
	
	public void init(Map<String, Object> userData) 
	{
		this.name = userData.get(User.USERNAME).toString();
		this.style = userData.get(User.STYLE).toString();
		this.messageQueue = new LinkedList<Message>();
		this.registeredUser.put(this.name, this);
		this.lastModification = System.currentTimeMillis();
	}
	
	public void destroy() 
	{
		this.registeredUser.remove(this.name);
		this.name = null;
	}
	
	public String getName() {
		return name;
	}
	
	public long getLastModification() {
		return lastModification;
	}

	public void setLastModification(long lastModification) {
		this.lastModification = lastModification;
	}
	
	public HashMap<String, User> getRegisteredUser() {
		return registeredUser;
	}

	public void setRegisteredUser(HashMap<String, User> registeredUser) {
		this.registeredUser = registeredUser;
	}

	public LinkedList<Message> getMessageQueue() {
		return messageQueue;
	}

	public void setMessageQueue(LinkedList<Message> messageQueue) {
		this.messageQueue = messageQueue;
	}

	public String getStyle() {
		return style;
	}

	public void setStyle(String style) {
		this.style = style;
	}
}
